<extend name="Base/common"/>
<block name="header">
    <include file="Public/nav"/>
</block>
<block name="body">


<!--<link href="__JS__/breakingnews.css" type="text/css" rel="stylesheet">-->
    <div style="position: relative;height: 130px;margin-top: 90px;background: white;margin-bottom: 10px">
        <div style="position: absolute;left: 50px;;top: -90px;">
            <img style="width: 180px;height: 180px;border: 1px solid #eee" src="__IMG__/plugin.jpg"/>
        </div>
        <div style="margin-left: 250px;padding-top:5px;position: relative">
            <h3 style="margin-top: 10px"><strong>插件</strong> <sub>Plugin</sub></h3>

            <p>插件存放在/Addons目录下，可以自由开启关闭，插件依赖于钩子。</p>

            <div>
                <a class="btn btn-warning" href="http://os.opensns.cn/book/index/read/section_id/80.html"
                   target="_blank"><i class="icon-file-text"></i> 开发手册</a>
                &nbsp; &nbsp; <a class="btn btn-success" href="{:U('Admin/addplugin')}"
                                 href="{:U('Admin/addplugin')}">+
                发布插件 &nbsp;</a> <!--  <button class="btn btn-danger">+ 关注 &nbsp;</button>-->
            </div>
            <div class=""
                 style="margin-top: 10px;margin-bottom: 10px;position: absolute;right: 10px;top: 20px;width: 250px">
                <form action="__SELF__" method="post">
                    <div class="search_input">
                        <div class="input-group">

                            <input name="keywords" type="text" class="form-control" placeholder="输入插件名称"
                                   value="{$keywords}">
          <span class="input-group-btn">
            <button class="btn btn-default" type="submit">搜索</button>
          </span>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <!--推荐模板部分-->
    <eq name="can_manage" value="1">
        <!--如果允许管理-->
        <div id="frm-post-popup" class="white-popup mfp-hide" style="position: relative">

            <h2>选择插件添加</h2>

            <div class="aline" style="margin-bottom: 10px"></div>
            <div style="margin-bottom: 10px ">选择插件：</div>
            <select id="add_goods_id" data-placeholder="选择推荐的插件" class="chosen-select form-control" tabindex="2"
                    value="33">
                <volist name="goods" id="vo">
                    <option value="{$vo.id}">{$vo.title}</option>
                </volist>
            </select>

            <div class="margin-top-10">
                <button class="btn btn-success btn-block" onclick="add_goods()">+ 添加</button>
            </div>

            <div>
            </div>
            <link href="__ZUI__/lib/chosen/chosen.css" type="text/css" rel="stylesheet"/>
            <script src="__ZUI__/lib/chosen/chosen.js"></script>

            <script>
                $(function () {

                    $('.open-popup-link').magnificPopup({
                        type: 'inline',
                        midClick: true, // Allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source in href.
                        closeOnBgClick: false,
                        callback: function () {
                            if ($.fn.chosen) $('.chosen-select').chosen();
                        }
                    });
                });

                function add_goods() {
                    $('.mfp-close').click();
                    $.post(U('Appstore/Index/setRecommonedGoods'), {
                        id: $('#add_goods_id').val(),
                        entity:1
                    }, function (msg) {
                        if (msg.status) {
                            toast.success(msg.info + '页面即将刷新。')
                            setTimeout('location.reload()', 1500)
                        } else {
                            toast.error(msg.info)
                        }

                    }, 'json');
                }
            </script>
        </div>
    </eq>
    <if condition="$can_manage||count($recommond_goods)">
        <link href="__JS__/datouwang.css" type="text/css" rel="stylesheet">
        <div class="common-block margin-bottom-10 recom ">
            <header>
                小编推荐
                <div class="fr" style="margin-top: -13px;">
                    <ul id="tabT04" class="tab-T-3 mt20 clearfix">
                        <php>
                            $recommond_num=count($recommond_goods);
                            if($can_manage==1){
                            $recommond_num=$recommond_num+1;
                            }
                            $num=$recommond_num/6;
                            if(intval($num)<$num){
                            $num=intval($num)+1;
                            }else{
                            $num=intval($num);
                            }
                            if($num>1){
                            for($i=0;$i<$num;$i++){
                            if($i==0){
                            $curr='cur';
                            }else{
                            $curr='';
                            }
                        </php>
                        <li class="{$curr}"></li>
                        <php>}}</php>
                    </ul>
                </div>
            </header>
            <section>
                <div class="rowE">
                    <div class="bd ">
                        <div id="sca1" class="warp-pic-list">
                            <div id="wrapBox1" class="wrapBox">
                                <ul id="count1" class="count clearfix">
                                    <volist name="recommond_goods" id="vo">
                                        <li>
                                            <a href="{:U('pluginDetail',array('id'=>$vo['id']))}" class="img_wrap">{$vo.cover|display_cover=168,168}</a>

                                            <div class="text-area">
                                                <p class="text-ellipsis"><a
                                                        href="{:U('pluginDetail',array('id'=>$vo['id']))}">{$vo.title}</a>
                                                </p>

                                                <p class="text-muted text-ellipsis">
                                                    <empty name="vo.author">
                                                        <a
                                                                href="{$vo.user.space_url}">{$vo.user.nickname}</a>
                                                        <else/>
                                                        {$vo.author}
                                                    </empty>
                                                </p>

                                                <p style="height: 20px">{$vo.versions.0.id|display_fee_tiny}</p>
                                            </div>
                                        </li>
                                    </volist>
                                    <eq name="can_manage" value="1">
                                        <li>
                                            <a href="#frm-post-popup" class="open-popup-link">
                                                <div class="img_wrap"
                                                     style="height:165px;background: #333;color:white;font-size: 120px;text-align: center;line-height:140px">
                                                    +
                                                </div>
                                                <div class="text-area"
                                                     style="  height: 100px;  line-height: 59px;  font-size: 32px;  color: #666;text-align: center;padding-left: 0 ">
                                                    添加插件
                                                </div>
                                            </a>
                                        </li>
                                    </eq>
                                </ul>
                            </div>
                            <php>
                                if($num>1){
                            </php>
                            <a id="right1" class="prev icon btn-recom"></a>
                            <a id="left1" class="next icon btn-recom"></a>
                            <php>}</php>
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </if>
    <!--<div>
        <div class="demo demo1" style="width: 800px;margin-bottom: 10px">
            <div class="BreakingNewsController easing" id="breakingnews1">
                <div class="bn-title"></div>
                <ul>
                    <li><a href="http://www.lanrentuku.com/" target="_blank">jqueryrotate制作百度红包大放送抽奖效果</a></li>
                    <li><a href="http://www.lanrentuku.com/" target="_blank">jQuery全屏滚动插件fullPage.js</a></li>
                    <li><a href="http://www.lanrentuku.com/" target="_blank">fullPage.js制作网易邮箱6.0介绍页面</a></li>
                    <li><a href="http://www.lanrentuku.com/" target="_blank">onepage-scroll制作iPhone 5s页面</a>
                    </li>
                    <li><a href="http://www.lanrentuku.com/" target="_blank">强大实用的jQuery幻灯片插件Owl Carousel</a>
                    </li>
                    <li><a href="http://www.lanrentuku.com/" target="_blank">slick制作17173 ChainJoy2014幻灯片</a>
                    </li>
                </ul>
                <div class="bn-arrows"><span class="bn-arrows-left"></span><span class="bn-arrows-right"></span>
                </div>
            </div>
        </div>
    </div>-->


    <div class="container common-block templet">
        <section>

            <div class="row">

                <div class="col-xs-12">
                    <ul class="nav nav-secondary" style="margin-top: 10px">
                        <volist name="types" id="vo">
                            <li id="type_{$vo.id}"><a href="{:U('plugin?tid='.$vo['id'])}">{$vo.title} （{$vo.count}）</a>
                            </li>
                        </volist>

                    </ul>
                </div>
                <script>
                    $("#type_{$current_type}").addClass('active');
                </script>
            </div>
            <div style="padding:10px">

            </div>
            <div class="up_search row">
                <div class="col-xs-9">
                    <ul class="nav nav-secondary">

                        <a class=" btn btn-default" href="{:U('plugin',array_merge($param,array('order'=>'update')))}">最后更新
                            <eq name="param.order" value="update">从新到旧 ↓</eq></a>
                        <a class=" btn btn-default" href="{:U('plugin',array_merge($param,array('order'=>'create')))}">最后发布
                            <eq name="param.order" value="create">从新到旧 ↓</eq></a>
                        <a href="{:U('plugin',array_merge($param,array('order'=>'sales')))}"  class=" btn btn-default">销量
                            <eq name="param.order" value="sales">从高到低 ↓</eq>
                        </a>
                    <!--    <a href="{:U('plugin',array_merge($param,array('order'=>'download')))}"
                           class="btn btn-default">下载量
                            <eq name="param.order" value="download">从高到低 ↓</eq>
                        </a>-->
                        <a href="{:U('plugin',array_merge($param,array('order'=>'watch')))}"
                           class="btn btn-default">订阅量
                            <eq name="param.order" value="watch">从高到低 ↓</eq>
                        </a>
                        <!-- <div class="btn-group ">
                             <button id="order2" type="button" class="btn btn-default  dropdown-toggle" data-toggle="dropdown">价格排序 <span class="caret"></span></button>
                             <ul class="dropdown-menu" role="menu" aria-labelledby="order1">
                                 <li><a href="#">从高到低</a></li>
                                 <li><a href="#">从低到高</a></li>
                             </ul>
                         </div>-->
                    </ul>
                </div>
                <div class="col-xs-3 text-right">
                   <div class="nav nav-secondary" style="display: inline-block">
                        <li id="type_all" type="button"><a
                                href="{:U('plugin',array_merge($param,array('type'=>'all')))}">全部</a></li>
                        <li id="type_free" type="button"><a href="{:U('plugin',array_merge($param,array('type'=>'free')))}">Free 免费</a>
                        </li>
                        <li id="type_notfree" type="button" class=" "><a
                                href="{:U('plugin',array_merge($param,array('type'=>'notfree')))}">付费</a></li>

                    </div>
                    <script>
                        $("#type_{$param.type}").addClass('active');
                    </script>
                </div>

                <!--搜素框-->
                <!--搜素框-->
            </div>

            <div class="clearfix"></div>

            <!-- 插件列表部分-->

            <empty name="lists.data">
                <div class="with-padding">
                    <div style="width: 50%;margin: auto">
                        <div class="alert  with-icon">
                            <i class="icon-inbox"></i>

                            <div class="content">

                                <p style="font-size: 16px">暂时没有插件。赶紧 <a class="text-success"
                                                                        href="{:U('Admin/addplugin')}">发布</a>
                                    一款，成为第一个商品。</p>
                            </div>
                        </div>
                    </div>
                </div>

                <else/>

                <ul class="clearfix goods-list">
                    <volist name="lists.data" id="vo">

                        <li style="">
                            <div class="clearfix">
                                <div style="width: 110px;float: left"><a
                                        href="{:U('pluginDetail',array('id'=>$vo['id']))}"
                                        class="app_icon"><b></b>
                                    {$vo.cover|display_cover}

                                </a></div>
                                <div class="col-xs-3" style="width:350px;">
                                    <h3 class="margin-top-0"><a href="{:U('pluginDetail',array('id'=>$vo['id']))}">{$vo.title}</a>
                                        {$vo.latest_version|display_version=true}
                                    </h3>

                                    <p class="ad text-muted">
                                        {$vo.ad|default='暂无商品介绍。'}</p>


                                    <p class="text-muted"> 服务商：
                                        {$vo.id|display_shop}
                                        <!-- 更新：{$vo.update_time|friendlyDate}    &nbsp;&nbsp;&nbsp;     发布：{$vo.create_time|friendlyDate}-->
                                    </p>
                                </div>
                                <div class="col-xs-3 " style="width: 300px;position: relative">
                                    &nbsp;
                                    <div class="price_area" style="">
                                        <div class="inner-content">{$vo.versions.0.id|display_fee_detail}</div>
                                    </div>
                                </div>
                                <div class="col-xs-4" style="width: 250px">
                                    <table class="text-center data-cols">
                                        <tr>
                                            <td>销量<br/><span class="text-danger">{$vo.sales}</span></td>
                                            <td>订阅<br/><span class="text-success">{$vo.watch_count}</span></td>
                                            <td>下载<br/><span class="count">{$vo.total_download_count|display_download_times}</span>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </div>

                        </li>

                    </volist>
                </ul>
            </empty>

            <!-- 插件列表部分-->

            <div class="pull-right"> {$lists.html}</div>
        </section>

        <script>
            $(function () {
                $('.goods-list >li').mouseenter(function () {
                    var $this = $(this).find('.price_area');
                    if ($this.children('.inner-content').height() > 100) {
                        $this.addClass('price-focus');
                        $this.css('top', (80 - $this.height()) / 2 + 'px');

                    }
                    $(this).addClass('li-focus')

                })
                $('.goods-list >li').mouseleave(function () {
                    var $this = $(this).find('.price_area');
                    $this.removeClass('price-focus');
                    $this.css('top', 0);
                    $(this).removeClass('li-focus')
                })
            })

            $(document).ready(function () {

                $("#count1").dayuwscroll({
                    parent_ele: '#wrapBox1',
                    list_btn: '#tabT04',
                    pre_btn: '#left1',
                    next_btn: '#right1',
                    path: 'left',
                    auto: true,
                    time: 3000,
                    num: 6,
                    gd_num: 6,
                    waite_time: 1000
                });

            });
        </script>
        <script src="__JS__/scroll.1.3.js">


        </script>
        <script src="__JS__/breakingnews.js">
            $(function () {
                $('#breakingnews1').BreakingNews({
                    title: '公告'
                });
            })

        </script>
    </div>

</block>